package com.xpjhs.importexcel;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;

import com.xpjhs.user.service.ImportExcelService;

@Controller
@RequestMapping("/import")
public class ImportController {
	@Autowired
	private ImportExcelService importExcelService;
	@RequestMapping("/user")
	public String importUser(MultipartFile importFile) throws IOException, InvocationTargetException, IllegalAccessException{
		importExcelService.importExcel(importFile.getInputStream());
		return null;
	}
	@RequestMapping("/user2")
	public String importUser2() throws IOException, InvocationTargetException, IllegalAccessException{
		
		importExcelService.importExcel(new InputStream() {
			
			@Override
			public int read() throws IOException {
				// TODO Auto-generated method stub
				return 0;
			}
		});
		return null;
	}
}
